package cn.iocoder.yudao.module.trade.service.order;

import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderOperateTypeEnum;
import cn.iocoder.yudao.module.trade.framework.order.core.annotations.TradeOrderLog;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class TradeOrderCreateServiceImpl implements TradeOrderCreateService{

    @Resource
    private TradeOrderUpdateService tradeOrderUpdateService;
    @Resource
    private MemberUserApi memberUserApi;
    @Override
    @Transactional(rollbackFor = Exception.class)
    @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_CREATE)
    public TradeOrderDO createOrder(Long userId,Long deliveryUserId, String userIp, AppTradeOrderCreateReqVO createReqVO, Integer terminal) {
        createReqVO.setDeliveryUserId(deliveryUserId);
        return tradeOrderUpdateService.createOrder(userId,userIp,createReqVO,terminal);
    }
}
